<extend name="Public:base" />
<block name="content">
<div class="page-header">
		<h1>
			{$breadcrumb2}
			<small>
				<i class="icon-double-angle-right"></i>
				{$crumbs}
			</small>
		</h1>
	</div>
<div class="row">
	<div class="col-xs-12">	
		<form class="form-horizontal" id="validation-form"  method="post" action='{$action}'>
			
			<notempty name="Think.get.id">
			<input name="weight_class_id" type="hidden" value="{$Think.get.id}" />
			</notempty>
			

			
			<div class="form-group">
				<label class="col-sm-1 control-label no-padding-left"> * 重量名称 </label>
			<div class="col-sm-11">
				<div class="clearfix">
				<input name="title" id="title" class="col-xs-10 col-sm-5"  value="{$d.title|default=''}" type="text">
				</div>
			</div>
			</div>
			<div class="space-4"></div>
			
			<div class="form-group">
				<label class="col-sm-1 control-label no-padding-left"> *单位 </label>
			<div class="col-sm-11">
				<div class="clearfix">
				<input name="unit" id="unit" class="col-xs-10 col-sm-5" value="{$d.unit|default=''}" type="text">
				</div>
			</div>
			</div>
			<div class="space-4"></div>			
			
			
			<div class="form-group">
				<label class="col-sm-1 control-label no-padding-left"> *值 </label>
			<div class="col-sm-11">
				<div class="clearfix">
				<input name="value" id="value" class="col-xs-10 col-sm-5" value="{$d.value|default=''}" type="text">
				</div>
			</div>
			</div>
			
			<div class="form-group">
				<label class="col-sm-1 control-label no-padding-left"> </label>	
				<div class="col-sm-11">
					<input name="send" type="submit" value="提交" class="btn btn-primary" />
				</div>
			</div>
		</form>
	</div>
</div>
</block>
<block name="javascript">
<script src="__JS__/jquery.validate.min.js"></script>	
<script>
$(function(){
	
	$('#validation-form').validate({
			errorElement: 'div',
			errorClass: 'help-block',
			focusInvalid: false,
			rules: {				
				title: {
					required: true,
					minlength: 1
				},
				unit: {
					required: true					
				},
				value: {
					required: true
				}		
						
			},
	
			messages: {
				
				title: {
					required: "必填",
					minlength: "不得少于1个字"
				},
				unit: {
					required: "必填"					
				},
				value: {
					required: "必填"					
				},
				
			},
	
			invalidHandler: function (event, validator) { //display error alert on form submit   
				$('.alert-danger', $('.login-form')).show();
			},
	
			highlight: function (e) {
				$(e).closest('.form-group').removeClass('has-info').addClass('has-error');
			},
	
			success: function (e) {
				$(e).closest('.form-group').removeClass('has-error').addClass('has-info');
				$(e).remove();
			},
	
			errorPlacement: function (error, element) {
				 error.insertAfter(element.parent());
			},

		});
			
});
</script>							
</block>